import request from '@/utils/request'

/**
 * 获取企业部门信息
 * @returns promiss对象
 */
export const getdepartmentsAPI = () => {
  return request({
    url: '/company/department'
  })
}

/**
 * 获取员工简单信息
 * @returns promise对象
 */
export const getEmployeesSimpleAPI = () => {
  return request({
    url: '/sys/user/simple'
  })
}

/**
 * 新增部门信息
 * @param {*} data
 * @returns promise对象
 */
export const addDepartmentsAPI = (data) => {
  return request({
    url: '/company/department',
    method: 'POST',
    data: data
  })
}

/**
 * 根据id获取部门详情信息
 * @param {*} id
 * @returns promise对象
 */
export const getDepartDetailAPI = (id) => {
  return request({
    url: `/company/department/${id}`

  })
}

/**
 *  根据id修改部门详情信息
 * @param {*} dataObj
 * @returns promise对象
 */
export const updateDepartDetailAPI = (dataObj) => {
  return request({
    url: `/company/department/${dataObj.id}`,
    method: 'PUT',
    data: dataObj

  })
}

/**
 * 根据id删除部门信息
 * @param {*} id
 * @returns promise对象
 */
export const delDepartAPI = (id) => {
  return request({
    url: `/company/department/${id}`,
    method: 'DELETE'

  })
}
